package cn.hl.sfzy.service.impl;

import cn.hl.sfzy.entity.Article;
import cn.hl.sfzy.entity.Publicity;
import cn.hl.sfzy.mapper.PublicityMapper;
import cn.hl.sfzy.service.PublicityService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName PublicityServiceImpl
 * @Description TOOO
 * @Author Lilysi
 * @Date 2024//10//24//16:06
 * @Version 1.0
 */
@Service
public class PublicityServiceImpl implements PublicityService {
    @Autowired
    private PublicityMapper publicityMapper;
    @Override
    public int delete(Long id) {
        int delete = publicityMapper.delete(id);
        return delete;
    }

    @Override
    public int update(Publicity publicity) {
        int update = publicityMapper.update(publicity);
        return update;
    }

    @Override
    public int insert(Publicity publicity) {
        int insert = publicityMapper.insert(publicity);
        return insert;
    }

    @Override
    public PageInfo<Publicity> findByPage(int pageNum, int pageSize, Publicity publicity) {
        PageHelper.startPage(pageNum, pageSize);
        PageInfo<Publicity> publicityPageInfo = new PageInfo<>(publicityMapper.select(publicity));
        return publicityPageInfo;
    }
}
